<% 
   import ycoa.data.classes.ClassFactory 

   def classFactory = ClassFactory.getInstance()
   def sessions = classFactory.getSessions()
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>YCOA Class Search</title>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
<link rel="apple-touch-icon" href="/lib/iui/iui-logo-touch-icon.png" />
<meta name="apple-touch-fullscreen" content="YES" />
<style type="text/css" media="screen">@import "/lib/iui/iui.css";</style>
<script type="application/x-javascript" src="/lib/iui/iui.js"></script>
<!--
<script type="application/x-javascript" src="http://10.0.1.2:1840/ibug.js"></script>
-->
</head>

<body>
    <div class="toolbar">
        <h1 id="pageTitle"></h1>
        <a id="backButton" class="button" href="#"></a>
        <a class="button" href="#searchForm">Search</a>
    </div>
    
    <ul id="home" title="Class Search" selected="true">
        <li><a href="#bySport">by Sport</a></li>
        <li><a href="#byLocation">by Location</a></li>
    </ul>

    <ul id="byLocation" title="Search by Location" selected="false">
   <% sessions.each() { session -> %>
        <li><a href="#${session.replaceAll(' ','_')}byLocation.gtpl" target="_self">${session}</a></li>
   <% } %>
    </ul>

    <ul id="bySport" title="Search by Sport" selected="false">
   <% sessions.each() { session -> %>
        <li><a href="#${session.replaceAll(' ','_')}_bySport">${session}</a></li>
   <% } %>
    </ul>

    <form id="searchForm" class="dialog" action="search.php">
        <fieldset>
            <h1>Class Search</h1>
            <a class="button leftButton" type="cancel">Cancel</a>
            <a class="button blueButton" type="submit">Search</a>
            
            <label>query:</label>
            <input id="query" type="text" name="location"/>
        </fieldset>
    </form>

</body>
</html>
